package com.ruin.tech.ahri.controller;

import com.ruin.tech.ahri.model.vo.VideoAndNoticeVO;
import com.ruin.tech.ahri.result.Result;
import com.ruin.tech.ahri.result.ResultCode;
import com.ruin.tech.ahri.result.ResultFactory;
import com.ruin.tech.ahri.service.IInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program ahri
 * @description: 通用信息获取
 * @author: ruin
 * @create: 2019/11/28 15:08
 */
@Slf4j
@RestController
@RequestMapping("/info")
public class InfoController {

    @Autowired
    IInfoService infoService;

    @PostMapping(value = "/vidoeAndNotice", produces = "application/json;charset=utf-8")
    public Result getVidoeAndNotice() {
        try{
            VideoAndNoticeVO videoAndNoticeVO = infoService.getVideoAndNotice();
            return ResultFactory.buildSuccessResult(videoAndNoticeVO);
        }catch (Exception e){
            log.error("获取视频和公告信息失败",e);
            return ResultFactory.buildFailResult(ResultCode.UPLOAD_AVATAR_FAIL);
        }
    }

}
